package com.jkl.databaseserver.Web.Service;

import com.jkl.databaseserver.Web.DAO.mapper.RelationshipMapper;
import com.jkl.databaseserver.Web.DAO.mapper.MessageMapper;
import com.jkl.databaseserver.Web.DAO.pojo.Message;
import com.jkl.databaseserver.Web.DAO.pojo.Relationship;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WsService {
    private final MessageMapper messageMapper;
    private final RelationshipMapper relationshipMapper;

    @Autowired
    public WsService(MessageMapper messageMapper, RelationshipMapper relationshipMapper) {
        this.messageMapper = messageMapper;
        this.relationshipMapper = relationshipMapper;
    }
    public void saveMessage(Message message){
        messageMapper.insertMessage(message);
    }

    public void buildRelationship(Relationship relationship){
        relationshipMapper.buildRelationship(relationship);
    }
    public void confirmRelationship(Relationship relationship){
        relationshipMapper.confirmRelationship(relationship);
    }
}
